package com.css.fxfzdzzh.modules.hypergraph.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.css.fxfzdzzh.base.dict.repository.DictItemRepository;
import com.css.fxfzdzzh.base.dict.repository.entity.DictItemEntity;
import com.css.fxfzdzzh.base.response.RestResponse;
import com.css.fxfzdzzh.modules.downloadLegend.entity.TemplateEntity;
import com.css.fxfzdzzh.modules.evaluate.VO.PolygonEvaluateResultVO;
import com.css.fxfzdzzh.modules.evaluate.service.SoftSoilService;
import com.css.fxfzdzzh.util.PlatformObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.*;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.*;

/**
 * @Description: fxfzdzzh
 * @Author: lhl
 * @CreateDate: 2023/6/5 14:23
 * 超图
 */
public interface HypergraphService {


    /**
     * 调度器使用的RestTemplate，超时6000s
     * @return
     */
    public RestTemplate getRestTemplate();

    //调用超图自动化处理服务等功能
    public RestResponse getServerToken(Map<String, Object> map);

    //根据数据集名获取数据服务详情datasetInfo
    public RestResponse getDatasetInfoByDataset(String dataset);

    //SQL查询超图图层数据
    public RestResponse mapSqlQueryResultsPost(String layerUrl, String datasource, String dataset, String networkType, String sqlFilter);

    //获取Web打印出图模板列表
    public List<TemplateEntity> getWebprintingLayoutsList();

    //上传模板文件到超图模板目录
    public RestResponse uploadTemplateFile(String attachId);

    //刷新指定超图工作空间数据源数据集
    public boolean getWorkspaceReload(String dataset);

    //刷新指定超图工作空间数据源数据集
    public boolean getWorkspaceReload(String datasource, String dataset);

    //获取超图服务token
    public String getToken();

    //根据名称、类型批量删除数据集
    public boolean batchDelByLayerType(String layerName, String layerType);

    //清除超图工作空间临时数据集
    public void deleteWorkspaceDatasetTemp();

    //删除数据库空间表
    public void dropGeometryTable(String tableName);

    //查询数据库矢量数据到dzzhTifCount
    public String dzzhVectorQuery(String queryType, String layerName, String sqlFilter,String timeStamp);

    //点数据集栅格克吕金插值分析提取等值面发布
    public String dzzhVectorToGridPolygon(String pointLayerName, String queryType, String fieldName, String timeStamp);

    //软土震陷点数据集栅格克吕金插值分析提取等值面发布
    public RestResponse softSoilPointToGridPolygon(String dtId, String dtcvId);

    //软土震陷根据烈度计算并保存等值面
    public List<PolygonEvaluateResultVO> countPolygonEvaluateResult(List<PolygonEvaluateResultVO> voList, String dtcvId,String intensity, String resultLayerName, String timeStamp);
}
